class MyQueue {
public:
    stack<int> ins;
    stack<int> outs;
    MyQueue() {
        
    }

    void modify()
    {
        if(outs.empty())
        {
            if(ins.empty()) return;
            while(!ins.empty())
            {
                outs.push(ins.top()); ins.pop();
            }
        }
    }
    
    void push(int x) {
        ins.push(x);
    }
    
    int pop() {
        modify();
        if(outs.empty()) return -1;
        int res=outs.top(); outs.pop();
        return res;
    }
    
    int peek() {
        modify();
        if(outs.empty()) return -1;
        return outs.top();
    }
    
    bool empty() {
        return ins.empty()&&outs.empty();
    }
};

/**
 * Your MyQueue object will be instantiated and called as such:
 * MyQueue* obj = new MyQueue();
 * obj->push(x);
 * int param_2 = obj->pop();
 * int param_3 = obj->peek();
 * bool param_4 = obj->empty();
 */